home *** CD-ROM | disk | FTP | other *** search
- Path: dragon.cs.hku.hk!kwho
- From: kwho@csd.hku.hk (Lord Hermes)
- Newsgroups: comp.lang.c++
- Subject: Re: Question on char to int and back
- Date: 4 Feb 1996 03:30:16 GMT
- Organization: Department of Computer Science, The University of Hong Kong
- Message-ID: <4f1988$dnk@ns.cs.hku.hk>
- References: <miller.1.00C350A1@crosslink.net>
- NNTP-Posting-Host: dragon.cs.hku.hk
- X-Newsreader: TIN [version 1.2 PL2]
-
- : This might seem like a trivial question but I would like to know how I can go
- : from reading in a char, placing it in a stack of int (ie)
- : char c;
- : c = cin.get()
- : push(s,c);
- : now if the char was a '+', it would be entered into the stack as 43.
- : I know that a cout.put(c) will output it as a character but if I want
- : to pop it from the stack and act on it as a character how do I
- : convert it back to a character?
- Can it be "a = (char) (c && 0x00ff)"? (a is the character you
- want; c is the integer you pop from the stack)
-